package com.jsonal.controller.manager;

import com.jsonal.entity.manager.NavicatBarBean;
import com.jsonal.service.manager.NavicatService;
import com.jsonal.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: jsonal
 * @Description: 导航栏配置
 * @Date: 2021/2/1 10:40
 * @Version: 1.0
 */
@RestController
public class NavicatController {

    @Autowired
    private NavicatService navicatService;

    @GetMapping("/managers/getNavicatList")
    public Result getNavicatList(NavicatBarBean navicatBarBean) {
        return navicatService.getNavicatList(navicatBarBean);
    }

    @PostMapping("/managers/addOrUpdateNavicat")
    public Result addOrUpdateNavicat(@RequestBody NavicatBarBean navicatBarBean) {
        return navicatService.addOrUpdate(navicatBarBean);
    }

    @GetMapping("/managers/getNavicatById/{id}")
    public Result getNavicatById(@PathVariable String id) {
        if ("".equals(id) || null == id) {
            return new Result(false, "id不能为空！");
        }
        return navicatService.getNavicatById(id);
    }

    @GetMapping("/managers/deleteNavicatById/{id}")
    public Result deleteNavicatById(@PathVariable String id) {
        if ("".equals(id) || null == id) {
            return new Result(false, "id不能为空！");
        }
        return navicatService.deleteById(id);
    }
}
